package com.rowline.admin.module.study.math;

/**
 * ClassName:DiguiDemo
 * Created by 245167
 * on 2018/3/11  11:49
 * description:
 */
public class DiguiDemo {

    public static void main(String[] args) {
        int n = 10;
        System.out.println("当台阶数 n = " + n + " ,共有 " + sum(n) + " 种攀登的方法");

    }

    public static int sum(int n){
        if( n==1 ){
            return 1;
        }else if( n==2 ){
            return 2;
        }else {
            return sum(n - 1) + sum(n - 2);
        }
    }

}
